package com.chendx.store.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chendx.model.user.pojo.UserSign;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * Created by chendx on 2022/4/27.
 */
@Mapper
public interface UserSignMapper extends BaseMapper<UserSign> {

    @Update("update tb_user_sign set sign_score = sign_score - 50 where username = #{username} and sign_score >= 50")
    Integer decrScore(@Param("username") String username);

    @Update("update tb_user_sign set sign_score = sign_score + #{score} where username = #{username}")
    Integer addScore(@Param("username") String username,@Param("score") Integer score);
}
